<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link
	href="${ pageContext.request.contextPath }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet" />
<script type="text/javascript"
	src="${ pageContext.request.contextPath }/static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
	//修改密码验证
	$(function() {
		$("#submit")
				.click(
						function() {
							if (confirm("确定要修改密码吗?")) {
								$
										.ajax({
											url : "${pageContext.request.contextPath}/admin/admin_updatepsw.action",
											method : "get",
											data : {
												"password" : $("#password")
														.val(),
												"newpsw" : $("#newpsw").val(),
												"againpsw" : $("#againpsw")
														.val()
											},
											success : function(response) {
												console.log(response);
												let $sss = response.objectMap.sss;
												if (response.errorCode === "100") {
													alert($sss);
													window.location = "${pageContext.request.contextPath}/admin.action";
												} else {
													alert($sss);
												}
											},
											error : function() {
												alert("error");
											}
										});
								return false;
							}
						});

	});
</script>
</head>

<body>
	<form style="margin-top: 50px;">
		&nbsp;
		<table cellSpacing="1" cellPadding="5" width="45%" align="center"
			bgColor="#eeeeee" style="border: 1px solid #8ba7e3; height: 300px;">
			<tr height="50">
				<td class="ta_01" align="center" bgColor="#afd1f3" colSpan="4"
					height="26" style="font-size: 18px;"><strong>修改管理员密码</strong></td>
			</tr>
			<tr height="50">
				<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
					原有密码：</td>
				<td class="ta_01" bgColor="#f5fafe"><input type="text"
					id="password" name="password"></td>
			</tr>

			<tr height="50">
				<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
					新密码：</td>
				<td class="ta_01" bgColor="#f5fafe"><input type="password"
					value="" id="newpsw" name="newpsw"></td>
			</tr>

			<tr height="50">
				<td width="35%" align="center" bgColor="#f5fafe" class="ta_01">
					确认密码：</td>
				<td class="ta_01" bgColor="#f5fafe"><input type="password"
					value="" id="againpsw" name="againpsw"></td>
			</tr>

			<tr height="50">
				<td style="WIDTH: 100%; padding-right: 20px;" align="right"
					bgColor="#f5fafe" colSpan="6">
					<button type="submit" id="submit" class="btn btn-primary btn-sm">确认修改</button>
				</td>
			</tr>
		</table>
	</form>

</body>
</html>

